# -*- coding: utf-8 -*-
"""
@author:  yinbing.li(yinbing.li@zillnk.com)
@version: 1.0.0
@file:    leetcode167_两数之和_II_输入有序数组.py
@time:    2023/3/8 11:00
"""
from typing import List


class Solution:
    def twoSum(self, numbers: List[int], target: int) -> List[int]:
        i, j = 1, len(numbers)
        while i < j:
            s = numbers[i-1] + numbers[j-1]
            if s == target:
                break
            elif s < target:
                i += 1
            else:
                j -= 1
        return [i, j]


S = Solution()
print(S.twoSum([2, 7, 11, 15], 9))
